package com.weixinli.biz.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import com.weixinli.beans.DetailInfo;
import com.weixinli.beans.UserInfo;
import com.weixinli.biz.IUserInfoBiz;
import com.weixinli.dao.IDetailInfoDao;
import com.weixinli.dao.IUserInfoDao;

@Scope("prototype")
@Service("iUserInfoBiz")
public class UserInfoBizImpl implements IUserInfoBiz {
	
	private IUserInfoDao userInfoDao;
	
	private IDetailInfoDao iDetailInfoDao;
	
	
	public int addUserInfo(UserInfo ui) {
		int data=0;
		try{
			data=userInfoDao.addUserInfo(ui);
		} catch (Exception e1) {
			throw new RuntimeException();
		}
		if(data==0){
			throw new RuntimeException();
		}
		try{
			DetailInfo deatilInfo=new DetailInfo();
			deatilInfo.setW_uid(data);
			iDetailInfoDao.addDetailInfo(deatilInfo);
			
		}catch (Exception e1) {
			throw new RuntimeException();
		}
		if(data==0){
			throw new RuntimeException();
		}
		return data;
	}

	public List<UserInfo> getPageUserInfo(Integer pageNo, Integer pageSize) {
		return null;
	}

	public int getTotalUserInfo() {
		return 0;
	}

	public int delUserInfo(Integer w_uid) {
		return 0;
	}

	public UserInfo userLogin(UserInfo uf) {
		return userInfoDao.userLogin(uf);
	}

	public UserInfo userTest(UserInfo uf) {
		System.out.println(uf+"uf=====uf==========第二个");
		return userInfoDao.userTest(uf);
	}
	
	@Resource(name="iDetailInfoDao")
	public void setiDetailInfoDao(IDetailInfoDao iDetailInfoDao) {
		this.iDetailInfoDao = iDetailInfoDao;
	}

	@Resource(name="iUserInfoDao")
	public void setUserInfoDao(IUserInfoDao userInfoDao) {
		this.userInfoDao = userInfoDao;
	}
}
